package com.cookmenu.db;

import com.cookmenu.constant.DBConstant;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {

	public DBHelper(Context context) {
		super(context, DBConstant.DB_NAME, null, DBConstant.VERSION);
	}

	public void onCreate(SQLiteDatabase db) {
		StringBuffer sb = new StringBuffer();
		sb.append("create table if not exists ").append(DBConstant.TABLE_FOODNAME)
				.append(" ( ").append(DBConstant.ID)
				.append(" INTEGER PRIMARY KEY AUTOINCREMENT , ")  //INTEGER前加空格
				.append(DBConstant.FOODNAME).append(" VARCHAR(50) )");
		System.out.println(sb.toString());
		db.execSQL(sb.toString());	
	}

	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

	}

}
